package InnerClass;

public class Body {
    private String name;
    //外部类变量
    public class Heart
    {
        public void beat()
        {
            System.out.println("我是内部类的");
            System.out.println("我叫："+name);
        }
    }

    public void methodBody()
    {
        System.out.println("外部类的方法");
        new Heart().beat();
        //匿名对象调用内部方法
    }
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }
}
